package com.molichuxing.services.property;

/**
 * 付款方式(1:全款，2：分期)
 * @author xuelin yi
 */
public enum GoodsPaymentTypeEnum {

  WHOLE_PARAGRAPH(1, "全款"),STAGES(2, "月付");

  int value;
  String name;

  GoodsPaymentTypeEnum(int value, String name) {
    this.value = value;
    this.name = name;
  }

  public int getValue() {
    return value;
  }

  public String getName() {
    return name;
  }

  /**
   * 通过value获取枚举的name
   * @param value
   * @return
   */
  public static String getName(int value) {
    for (GoodsPaymentTypeEnum orderSource : GoodsPaymentTypeEnum.values()) {
      if (orderSource.getValue() == value) {
        return orderSource.name;
      }
    }
    return null;
  }

  /**
   * 通过value获取枚举的GoodsPaymentTypeEnum
   * @param value
   * @return
   */
  public static GoodsPaymentTypeEnum getEnum(int value) {
    for (GoodsPaymentTypeEnum orderSource : GoodsPaymentTypeEnum.values()) {
      if (orderSource.getValue() == value) {
        return orderSource;
      }
    }
    return null;
  }
}
